home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / libkcal / customproperties.h < prev    next >
Encoding:
C/C++ Source or Header  |  2007-01-15  |  4.4 KB  |  134 lines

  1. /*
  2.     This file is part of libkcal.
  3.  
  4.     Copyright (c) 2002,2006 David Jarvie <software@astrojar.org.uk>
  5.  
  6.     This library is free software; you can redistribute it and/or
  7.     modify it under the terms of the GNU Library General Public
  8.     License as published by the Free Software Foundation; either
  9.     version 2 of the License, or (at your option) any later version.
  10.  
  11.     This library is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.     Library General Public License for more details.
  15.  
  16.     You should have received a copy of the GNU Library General Public License
  17.     along with this library; see the file COPYING.LIB.  If not, write to
  18.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  19.     Boston, MA 02110-1301, USA.
  20. */
  21.  
  22. #ifndef KCAL_CUSTOMPROPERTIES_H
  23. #define KCAL_CUSTOMPROPERTIES_H
  24.  
  25. #include <qstring.h>
  26. #include <qmap.h>
  27. #include <kdepimmacros.h>
  28.  
  29. #include "libkcal_export.h"
  30.  
  31. namespace KCal {
  32.  
  33. /**
  34.   This class represents custom calendar properties.
  35.   It is used as a base class for classes which represent calendar components.
  36.   A custom property name written by libkcal has the form X-KDE-APP-KEY where
  37.   APP represents the application name, and KEY distinguishes individual
  38.   properties for the application.
  39.   In keeping with RFC2445, property names must be composed only of the
  40.   characters A-Z, a-z, 0-9 and '-'.
  41. */
  42. class LIBKCAL_EXPORT CustomProperties
  43. {
  44.   public:
  45.     /**
  46.       Construct a new empty custom properties instance.
  47.     */
  48.     CustomProperties();
  49.     CustomProperties( const CustomProperties & );
  50.     ~CustomProperties();
  51.  
  52.     bool operator==( const CustomProperties & ) const;
  53.  
  54.     /**
  55.       Create or modify a custom calendar property.
  56.       
  57.       @param app   Application name as it appears in the custom property name.
  58.       @param key   Property identifier specific to the application.
  59.       @param value The property's value. A call with a value of QString::null
  60.                    will be ignored.
  61.     */
  62.     void setCustomProperty( const QCString &app, const QCString &key,
  63.                             const QString &value );
  64.     /**
  65.       Delete a custom calendar property.
  66.       
  67.       @param app Application name as it appears in the custom property name.
  68.       @param key Property identifier specific to the application.
  69.     */
  70.     void removeCustomProperty( const QCString &app, const QCString &key );
  71.     /**
  72.       Return the value of a custom calendar property.
  73.       
  74.       @param app Application name as it appears in the custom property name.
  75.       @param key Property identifier specific to the application.
  76.       @return Property value, or QString::null if (and only if) the property
  77.               does not exist.
  78.     */
  79.     QString customProperty( const QCString &app, const QCString &key ) const;
  80.  
  81.     /**
  82.       Create or modify a non-KDE or non-standard custom calendar property.
  83.       
  84.       @param name Full property name
  85.       @param value The property's value. A call with a value of QString::null
  86.                    will be ignored.
  87.     */
  88.     void setNonKDECustomProperty( const QCString &name, const QString &value );
  89.     /**
  90.       Delete a non-KDE or non-standard custom calendar property.
  91.       
  92.       @param name Full property name
  93.     */
  94.     void removeNonKDECustomProperty( const QCString &name );
  95.     /**
  96.       Return the value of a non-KDE or non-standard custom calendar property.
  97.       
  98.       @param name Full property name
  99.       @return Property value, or QString::null if (and only if) the property
  100.               does not exist.
  101.     */
  102.     QString nonKDECustomProperty( const QCString& name ) const;
  103.  
  104.     /**
  105.       Initialise the alarm's custom calendar properties to the specified
  106.       key/value pairs.
  107.     */
  108.     void setCustomProperties( const QMap<QCString, QString> &properties );
  109.     /**
  110.       Return all custom calendar property key/value pairs.
  111.     */
  112.     QMap<QCString, QString> customProperties() const;
  113.  
  114.   protected:
  115.     /**
  116.       Called when a custom property has been changed.
  117.       The default implementation does nothing: override in derived classes
  118.       to perform change processing.
  119.     */
  120.     virtual void customPropertyUpdated()  {}
  121.  
  122.   private:
  123.     static bool checkName(const QCString& name);
  124.  
  125.     QMap<QCString, QString> mProperties;   // custom calendar properties
  126.  
  127.     class Private;
  128.     Private *d;
  129. };
  130.  
  131. }
  132.  
  133. #endif
  134.